/*
 *
 * @Date: 2022-06-15 20:44:15
 * @LastEditTime: 2022-06-19 19:29:31
 */
import {NgModule} from '@angular/core';
import {PreloadAllModules, RouterModule, Routes} from '@angular/router';
import {GuestGuard} from './guard/guest.guard';

const routes: Routes = [
  {
    path: 'ynuer',
    loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
  },
  {
    path: 'user/login',
    loadChildren: () => import('./page/login/login.module').then(m => m.LoginPageModule)
  },
  {
    path: 'user/register',
    loadChildren: () => import('./page/register/register.module').then(m => m.RegisterPageModule)
  },
  {
    path: 'create/:type',
    canActivate: [GuestGuard],
    loadChildren: () => import('./page/create/create.module').then(m => m.CreatePageModule),
  },
  {
    path: 'detail/:id',
    pathMatch: 'full',
    loadChildren: () => import('./page/detail/detail.module').then(m => m.DetailPageModule),
  },
  {
    path: '',
    redirectTo: 'ynuer/help',
    pathMatch: 'full'
  }

];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules})
  ],
  exports: [RouterModule]
})
export class AppRoutingModule {
}
